package com.blb.thread;

public class Demo4Priority {

    public static void main(String[] args) {
        Thread thread1 = new Thread(() ->{
            for (int i = 0;i <= 10; i++){
                System.out.println(Thread.currentThread().getName()+"--->"+i);
            }
        });
       thread1.setName("张三");
       //设置线程优先级，控制线程的执行过程
        thread1.setPriority(Thread.MAX_PRIORITY);
        thread1.start();

        Thread thread2 = new Thread(() ->{
            for (int i = 0;i <= 10; i++){
                System.out.println(Thread.currentThread().getName()+"--->"+i);
            }
        });
        thread2.setName("李四");
        //设置线程优先级，控制线程的执行过程
        thread2.setPriority(Thread.MIN_PRIORITY);
        thread2.start();

    }
}
